<?php
namespace app\common\controller;

class CommonApi extends Base{
    protected $user_info;

    public function _initialize(){
        parent::_initialize();
        $token = input('token','','trim');
        if($token == ''){
            $this->apiReturn(-1,'非法访问');
        }

        $Aes = new \Aes\Aes();
        $token = $Aes->aes128cbcHexDecrypt($token);
        $user = model('common/user')->getUserInfo(['token'=>$token],'*');
    
        if(is_null($user)){
            $this->apiReturn(-1,'无权访问');
        }

        if($user['disabled'] == 0){
            $this->apiReturn(-1,'该会员被禁用');
        }

      /*  if($user['photo_path'] == '' || $user['nick_name'] == '' || $user['zhiye'] == 0 || $user['tel'] == '' ){
            $this->apiReturn(0,'请先完善个人基本信息');
        }

        if($user['from_lng'] == '' || $user['from_lat'] == '' || $user['from_city'] == ''){
            $this->apiReturn(0,'请添加地点管理');
        }*/

        define('UID',$user['id']);
        $this->user_info = $user;
        $this->token = $token;
    }
    
}
